﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;

namespace imaginecup.util
{
    public struct EntityInfo
    {
        public static Rectangle GetRectangle(EntityInfo info)
        {
            return new Rectangle((int)info.mPosition.X, (int)info.mPosition.Y, (int)info.mSize.X, (int)info.mSize.Y);
        }
        public EntityInfo(int x, int y, int sizeX , int SizeY)
        {
            mPosition = new Vector2(x, y);
            mSize = new Vector2(sizeX , SizeY);
        }
        public EntityInfo(float x, float y, float sizeX, float SizeY)
        {
            mPosition = new Vector2(x, y);
            mSize = new Vector2(sizeX, SizeY);
        }

        public EntityInfo(Vector2 pos , Vector2 size)
        {
            mPosition = pos;
            mSize = size;
        }

        public Vector2 GetEntityCenter()
        {
            Vector2 v = new Vector2(mPosition.X + mSize.X / 2, mPosition.Y + mSize.Y / 2);
            return v;
        }

        public void SetEntityCenter(Vector2 center)
        {
            mPosition.X = center.X - mSize.X / 2;
            mPosition.Y = center.Y - mSize.Y / 2;
        }

        public void SetCenterX(float x)
        {
            mPosition.X = x - mSize.X / 2;
        }

        public void SetCenterY(float y)
        {
            mPosition.X = y - mSize.Y / 2;
        }

        public Vector2 mPosition;
        public Vector2 mSize;

    }
}
